let data = [
    {
        id: 111,
        title: "我是商品1",
        img: "https://img.dmallcdn.com/20190613/671cff4a-7dd3-43c9-b0d1-b1b2ff46d56b_480x480H",
    },
    {
        id: 112,
        title: "我是商品2",
        img: "https://img.dmallcdn.com/prod/163/20200923/401a4c1be82d4b5c9d05995adc8b10a0_480x480H",
    },
    {
        id: 113,
        title: "我是商品3",
        img: "https://img.dmallcdn.com/prod/163/20210826/69ec290376524551ba27796ea921070c_480x480H",
    }
]
module.exports = {
    // devServer  本地服务
    devServer: {
        // before  
        before(app) {
            // http://localhost:8080/getList
            app.get('/getDetail', (req, res) => {
                // 读取到前端传递的id
                let id = req.query.id
                // filter  find   some
                // 
                let arr = data.filter(item => item.id === Number(id))
                res.send({
                    msg: "获取成功",
                    data: arr[0]
                })
            })
        }
    }
}